/* Copyright (C) 2000-2012 by George Williams */
/*
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.

 * The name of the author may not be used to endorse or promote products
 * derived from this software without specific prior written permission.

 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <fontforge-config.h>

#include "basics.h"

/* divide data (division tricks for numbers<256) */
/* multiply by the first number, left shift by the second */
int16_t div_tables[257][2] = {
/*   0 */	{   0,  0},
/*   1 */	{   1,  0},
/*   2 */	{   1,  1},
/*   3 */	{ 171,  9},
/*   4 */	{   1,  2},
/*   5 */	{ 205, 10},
/*   6 */	{ 171, 10},
/*   7 */	{ 293, 11},
/*   8 */	{   1,  3},
/*   9 */	{  57,  9},
/*  10 */	{ 205, 11},
/*  11 */	{ 373, 12},
/*  12 */	{ 171, 11},
/*  13 */	{  79, 10},
/*  14 */	{ 293, 12},
/*  15 */	{ 137, 11},
/*  16 */	{   1,  4},
/*  17 */	{ 241, 12},
/*  18 */	{  57, 10},
/*  19 */	{  27,  9},
/*  20 */	{ 205, 12},
/*  21 */	{ 391, 13},
/*  22 */	{ 373, 13},
/*  23 */	{ 357, 13},
/*  24 */	{ 171, 12},
/*  25 */	{  41, 10},
/*  26 */	{  79, 11},
/*  27 */	{  19,  9},
/*  28 */	{ 293, 13},
/*  29 */	{ 283, 13},
/*  30 */	{ 137, 12},
/*  31 */	{ 265, 13},
/*  32 */	{   1,  5},
/*  33 */	{ 249, 13},
/*  34 */	{ 241, 13},
/*  35 */	{ 235, 13},
/*  36 */	{  57, 11},
/*  37 */	{ 111, 12},
/*  38 */	{  27, 10},
/*  39 */	{ 421, 14},
/*  40 */	{ 205, 13},
/*  41 */	{  25, 10},
/*  42 */	{ 391, 14},
/*  43 */	{ 191, 13},
/*  44 */	{ 187, 13},
/*  45 */	{ 365, 14},
/*  46 */	{ 357, 14},
/*  47 */	{ 175, 13},
/*  48 */	{ 171, 13},
/*  49 */	{ 335, 14},
/*  50 */	{  41, 11},
/*  51 */	{ 161, 13},
/*  52 */	{  79, 12},
/*  53 */	{ 155, 13},
/*  54 */	{  19, 10},
/*  55 */	{ 149, 13},
/*  56 */	{ 293, 14},
/*  57 */	{   9,  9},
/*  58 */	{ 283, 14},
/*  59 */	{ 139, 13},
/*  60 */	{ 137, 13},
/*  61 */	{ 269, 14},
/*  62 */	{ 265, 14},
/*  63 */	{ 261, 14},
/*  64 */	{   1,  6},
/*  65 */	{ 253, 14},
/*  66 */	{ 249, 14},
/*  67 */	{ 245, 14},
/*  68 */	{ 121, 13},
/*  69 */	{ 119, 13},
/*  70 */	{ 235, 14},
/*  71 */	{ 231, 14},
/*  72 */	{  57, 12},
/*  73 */	{ 225, 14},
/*  74 */	{ 111, 13},
/*  75 */	{ 219, 14},
/*  76 */	{  27, 11},
/*  77 */	{ 213, 14},
/*  78 */	{ 421, 15},
/*  79 */	{  13, 10},
/*  80 */	{ 205, 14},
/*  81 */	{ 203, 14},
/*  82 */	{  25, 11},
/*  83 */	{  99, 13},
/*  84 */	{ 391, 15},
/*  85 */	{ 193, 14},
/*  86 */	{ 191, 14},
/*  87 */	{ 189, 14},
/*  88 */	{ 187, 14},
/*  89 */	{ 185, 14},
/*  90 */	{ 183, 14},
/*  91 */	{ 181, 14},
/*  92 */	{ 179, 14},
/*  93 */	{ 177, 14},
/*  94 */	{ 175, 14},
/*  95 */	{ 173, 14},
/*  96 */	{ 171, 14},
/*  97 */	{ 169, 14},
/*  98 */	{  21, 11},
/*  99 */	{  83, 13},
/* 100 */	{  41, 12},
/* 101 */	{ 163, 14},
/* 102 */	{ 161, 14},
/* 103 */	{ 319, 15},
/* 104 */	{  79, 13},
/* 105 */	{ 313, 15},
/* 106 */	{ 155, 14},
/* 107 */	{ 307, 15},
/* 108 */	{  19, 11},
/* 109 */	{ 151, 14},
/* 110 */	{ 149, 14},
/* 111 */	{  37, 12},
/* 112 */	{ 293, 15},
/* 113 */	{ 145, 14},
/* 114 */	{   9, 10},
/* 115 */	{ 143, 14},
/* 116 */	{ 283, 15},
/* 117 */	{ 281, 15},
/* 118 */	{ 139, 14},
/* 119 */	{  69, 13},
/* 120 */	{ 137, 14},
/* 121 */	{ 271, 15},
/* 122 */	{ 269, 15},
/* 123 */	{ 267, 15},
/* 124 */	{ 265, 15},
/* 125 */	{ 263, 15},
/* 126 */	{ 261, 15},
/* 127 */	{ 259, 15},
/* 128 */	{   1,  7},
/* 129 */	{ 255, 15},
/* 130 */	{ 127, 14},
/* 131 */	{  63, 13},
/* 132 */	{ 125, 14},
/* 133 */	{  31, 12},
/* 134 */	{ 123, 14},
/* 135 */	{  61, 13},
/* 136 */	{ 121, 14},
/* 137 */	{  15, 11},
/* 138 */	{ 119, 14},
/* 139 */	{  59, 13},
/* 140 */	{ 235, 15},
/* 141 */	{ 117, 14},
/* 142 */	{  29, 12},
/* 143 */	{ 115, 14},
/* 144 */	{  57, 13},
/* 145 */	{ 113, 14},
/* 146 */	{ 225, 15},
/* 147 */	{   7, 10},
/* 148 */	{ 111, 14},
/* 149 */	{  55, 13},
/* 150 */	{ 219, 15},
/* 151 */	{ 109, 14},
/* 152 */	{  27, 12},
/* 153 */	{ 215, 15},
/* 154 */	{ 107, 14},
/* 155 */	{  53, 13},
/* 156 */	{ 211, 15},
/* 157 */	{ 105, 14},
/* 158 */	{  13, 11},
/* 159 */	{ 207, 15},
/* 160 */	{ 103, 14},
/* 161 */	{  51, 13},
/* 162 */	{ 203, 15},
/* 163 */	{ 101, 14},
/* 164 */	{  25, 12},
/* 165 */	{ 199, 15},
/* 166 */	{  99, 14},
/* 167 */	{ 197, 15},
/* 168 */	{  49, 13},
/* 169 */	{  97, 14},
/* 170 */	{ 193, 15},
/* 171 */	{   3,  9},
/* 172 */	{ 191, 15},
/* 173 */	{  95, 14},
/* 174 */	{ 189, 15},
/* 175 */	{  47, 13},
/* 176 */	{ 187, 15},
/* 177 */	{  93, 14},
/* 178 */	{ 185, 15},
/* 179 */	{  23, 12},
/* 180 */	{ 183, 15},
/* 181 */	{  91, 14},
/* 182 */	{ 181, 15},
/* 183 */	{  45, 13},
/* 184 */	{ 179, 15},
/* 185 */	{  89, 14},
/* 186 */	{ 177, 15},
/* 187 */	{  11, 11},
/* 188 */	{ 175, 15},
/* 189 */	{  87, 14},
/* 190 */	{ 173, 15},
/* 191 */	{  43, 13},
/* 192 */	{ 171, 15},
/* 193 */	{  85, 14},
/* 194 */	{ 169, 15},
/* 195 */	{ 337, 16},
/* 196 */	{  21, 12},
/* 197 */	{ 167, 15},
/* 198 */	{  83, 14},
/* 199 */	{ 165, 15},
/* 200 */	{  41, 13},
/* 201 */	{ 327, 16},
/* 202 */	{ 163, 15},
/* 203 */	{  81, 14},
/* 204 */	{ 161, 15},
/* 205 */	{   5, 10},
/* 206 */	{ 319, 16},
/* 207 */	{ 159, 15},
/* 208 */	{  79, 14},
/* 209 */	{ 157, 15},
/* 210 */	{ 313, 16},
/* 211 */	{  39, 13},
/* 212 */	{ 155, 15},
/* 213 */	{  77, 14},
/* 214 */	{ 307, 16},
/* 215 */	{ 153, 15},
/* 216 */	{  19, 12},
/* 217 */	{ 303, 16},
/* 218 */	{ 151, 15},
/* 219 */	{  75, 14},
/* 220 */	{ 149, 15},
/* 221 */	{ 297, 16},
/* 222 */	{  37, 13},
/* 223 */	{ 147, 15},
/* 224 */	{ 293, 16},
/* 225 */	{  73, 14},
/* 226 */	{ 145, 15},
/* 227 */	{ 289, 16},
/* 228 */	{   9, 11},
/* 229 */	{ 287, 16},
/* 230 */	{ 143, 15},
/* 231 */	{  71, 14},
/* 232 */	{ 283, 16},
/* 233 */	{ 141, 15},
/* 234 */	{ 281, 16},
/* 235 */	{  35, 13},
/* 236 */	{ 139, 15},
/* 237 */	{ 277, 16},
/* 238 */	{  69, 14},
/* 239 */	{ 275, 16},
/* 240 */	{ 137, 15},
/* 241 */	{  17, 12},
/* 242 */	{ 271, 16},
/* 243 */	{ 135, 15},
/* 244 */	{ 269, 16},
/* 245 */	{  67, 14},
/* 246 */	{ 267, 16},
/* 247 */	{ 133, 15},
/* 248 */	{ 265, 16},
/* 249 */	{  33, 13},
/* 250 */	{ 263, 16},
/* 251 */	{ 131, 15},
/* 252 */	{ 261, 16},
/* 253 */	{  65, 14},
/* 254 */	{ 259, 16},
/* 255 */	{ 129, 15},
/* 256 */	{   1,  8},
};
